/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="groups")
public class Group implements Serializable {
	public Group() {
	}
	
	private int id;
	
	private String code;
	
	private String name;
	
	private String remark;
	
	private Integer order;
	
	private java.util.Set user = new java.util.HashSet();
	
	private java.util.Set role = new java.util.HashSet();
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_GROUP_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_GROUP_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	public void setCode(String value) {
		this.code = value;
	}
	
	@Column(name="code", nullable=false, length=255)	
	@org.hibernate.annotations.Index(name="code")	
	public String getCode() {
		return code;
	}
	
	public void setName(String value) {
		this.name = value;
	}
	
	@Column(name="name", nullable=false, length=255)	
	public String getName() {
		return name;
	}
	
	public void setRemark(String value) {
		this.remark = value;
	}
	
	@Column(name="remark", nullable=true, length=255)	
	public String getRemark() {
		return remark;
	}
	
	public void setOrder(int value) {
		setOrder(new Integer(value));
	}
	
	public void setOrder(Integer value) {
		this.order = value;
	}
	
	@Column(name="`order`", nullable=true, length=10)	
	public Integer getOrder() {
		return order;
	}
	
	public void setUser(java.util.Set value) {
		this.user = value;
	}
	
	@ManyToMany(targetEntity=cn.imvc.app.entities.User.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@JoinTable(name="user_group", joinColumns={ @JoinColumn(name="groupid") }, inverseJoinColumns={ @JoinColumn(name="userid") })	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getUser() {
		return user;
	}
	
	
	public void setRole(java.util.Set value) {
		this.role = value;
	}
	
	@ManyToMany(targetEntity=cn.imvc.app.entities.Role.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@JoinTable(name="group_role", joinColumns={ @JoinColumn(name="groupid") }, inverseJoinColumns={ @JoinColumn(name="roleid") })	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getRole() {
		return role;
	}
	
	
	public String toString() {
		return String.valueOf(getId());
	}
	
}
